<template>
    <div class="app-container calendar-list-container">

        <!-- 查询和其他操作 -->
        <div class="filter-container">
          <el-input clearable class="filter-item" style="width: 200px;" placeholder="菜品编号" v-model="listQuery.dishesId"></el-input>
          <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查找</el-button>
        </div>

        <!-- 查询结果 -->
        <el-table size="small" :data="list" v-loading="listLoading" element-loading-text="正在查询中。。。" border fit highlight-current-row>
          <el-table-column align="center" min-width="120px" label="平台编号" prop="platformId">
          </el-table-column>
          <el-table-column align="center" min-width="120px" label="商户账号" prop="merId">
          </el-table-column>
          <el-table-column align="center" min-width="120px" label="菜品编号" prop="dishesId">
          </el-table-column>       
          <el-table-column align="center" min-width="100px" label="很满意数量" prop="verySatisfiedNum">
          </el-table-column>       
          <el-table-column align="center" min-width="100px" label="满意数量" prop="satisfiedNum">
          </el-table-column>   
          <el-table-column align="center" min-width="100px" label="一般数量" prop="generalNum">
          </el-table-column>   
          <el-table-column align="center" min-width="100px" label="不满意数量" prop="notSatisfiedNum">
          </el-table-column>       
          <el-table-column align="center" min-width="100px" label="总评价数量" prop="totalNum">
          </el-table-column>      

        </el-table>

        <!-- 分页 -->
        <div class="pagination-container">
        <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listQuery.page"
            :page-sizes="[10,20,30,50]" :page-size="listQuery.limit" layout="total, sizes, prev, pager, next, jumper" :total="total">
        </el-pagination>
        </div>

    </div>
</template>

<script>
import waves from '@/directive/waves' // 水波纹指令
import { listAppraisalInfo } from '@/api/cms/restaurant/appraisal'

export default {
  name: 'auction',
  directives: {
    waves
  },
  data() {
    return {
      listQuery: {
        page: 1,
        limit: 20,
        dishesId: ''
      },
      list: [],
      total: 0,
      listLoading: false,
      downloadLoading: false
    }
  },
  created() {
    this.getList()
  },
  methods: {
    handleFilter() {
      this.listQuery.page = 1
      this.getList()
    },
    handleSizeChange(val) {
      this.listQuery.limit = val
      this.getList()
    },
    handleCurrentChange(val) {
      this.listQuery.page = val
      this.getList()
    },
    getList() {
      this.listLoading = true
      listAppraisalInfo(this.listQuery).then(response => {
        console.log(response)
        this.list = response.data.rows
        this.total = response.data.total
        this.listLoading = false
      }).catch(() => {
        this.list = []
        this.total = 0
        this.listLoading = false
      })
    }
  }
}
</script>

<style>

</style>


